package com.lineage.server.clientpackets;

import com.lineage.echo.ClientExecutor;
import com.lineage.server.datatables.lock.CastleReading;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.L1Clan;
import com.lineage.server.serverpackets.S_WarTime;
import com.lineage.server.serverpackets.ServerBasePacket;
import com.lineage.server.templates.L1Castle;
import com.lineage.server.world.WorldClan;
import java.util.Calendar;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class C_ChangeWarTime extends ClientBasePacket {
  private static final Log _log = LogFactory.getLog(C_Buddy.class);
  
  public void start(byte[] decrypt, ClientExecutor client) {
    try {
      L1PcInstance pc = client.getActiveChar();
      L1Clan clan = WorldClan.get().getClan(pc.getClanname());
      if (clan != null) {
        int castle_id = clan.getCastleId();
        if (castle_id != 0) {
          L1Castle l1castle = CastleReading.get().getCastleTable(castle_id);
          Calendar cal = l1castle.getWarTime();
          pc.sendPackets((ServerBasePacket)new S_WarTime(cal));
        } 
      } 
    } catch (Exception exception) {
    
    } finally {
      over();
    } 
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
